<?php
/**
 * Created by PhpStorm.
 * User: china
 * Date: 2015/11/20
 * Time: 9:12
 */

namespace Application\UserCenter\Controller;


use Application\Common\Controller\ElementUIController;
use Application\Common\Controller\ManyElementUIActor;


/**
 * 用户管理操作
 */
class UserController extends ElementUIController
{
    protected function bindActor()
    {
        return new ManyElementUIActor($this);
    }

    protected function beforeAdd($add = [])
    {
        $add['createTime'] = time();
        $add['password'] = Password::generate();
        $add['ip'] = get_client_ip(1);

        return $add;
    }

    protected function beforeEdit($elements = [])
    {
        $elements['updateTime'] = time();
        return $elements;
    }
}